﻿/**********************************天使物流*******************************************
* 功能描述:系统设置——部门管理
* 作者:孟帅龙
* 时间:2022/1/10
* 
**********************************天使物流*******************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.Common;
using TianShiProject.Models.System.Departments;
using Volo.Abp.Application.Services;

namespace TianShiProject.System.Departments
{
    public class DepartmentService : ApplicationService
    {
        private readonly IDepartmentRepository _departmentRepository;
        public DepartmentService(IDepartmentRepository departmentRepository)
        {
            _departmentRepository = departmentRepository;
        }

        #region 部门管理——查询分页显示
        /// <summary>
        /// 部门管理——查询分页显示
        /// </summary>
        /// <param name="DeptName"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<DepartmentDto>> GetDepartmentPageShow(string DeptName, int pageindex = 1, int pagesize = 3)
        {
            return await _departmentRepository.GetDepartmentPageShow(DeptName, pageindex, pagesize);
        }
        #endregion

        #region 部门管理——逻辑删除
        /// <summary>
        /// 部门管理——逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<PageResponse<DepartmentDto>> DeleteDepartment(int id)
        {
            return await _departmentRepository.DeleteDepartment(id);
        }
        #endregion

        #region 部门管理——批量删除
        /// <summary>
        /// 部门管理——批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task<PageResponse<DepartmentDto>> DeleteBatchDepartment(string ids)
        {
            return await _departmentRepository.DeleteBatchDepartment(ids);
        }
        #endregion

        #region 部门管理——编辑
        /// <summary>
        /// 部门管理——编辑
        /// </summary>
        /// <param name="departmentDto"></param>
        /// <returns></returns>
        public async Task<int> PostUpdateDepartment(DepartmentDto departmentDto)
        {
            return await _departmentRepository.PostUpdateDepartment(departmentDto);
        }
        #endregion

        #region 部门管理——添加
        /// <summary>
        /// 部门管理——添加
        /// </summary>
        /// <param name="rolesDto"></param>
        /// <returns></returns>
        public async Task<int> PostAddDepartment(DepartmentDto departmentDto)
        {
            return await _departmentRepository.PostAddDepartment(departmentDto);
        }
        #endregion

        #region 部门下拉框
        /// <summary>
        /// 部门下拉框
        /// </summary>
        /// <returns></returns>
        public async Task<PageResponse<DepartmentDto>> GetDept()
        {
            return await _departmentRepository.GetDept();
        }
        #endregion
    }
}
